package edu.uestc.canary.entity.dto;

public record Result<T>(int statusCode, T data, String message) {
    public static Result ok(){
        return new Result(2000, null, "业务执行成功");
    }

    public static<T> Result<T> ok(T data){
        return new Result(2000, data, "业务执行成功");
    }

    public static<T> Result<T> ok(T data, String message){
        return new Result(2000, data, message);
    }

    public static Result fail(){
        return new Result(5000, null, "业务执行失败");
    }

    public static Result fail(String message){
        return new Result(5000, null, message);
    }

    public static<T> Result<T> fail(T data, String message){
        return new Result(5000, data, message);
    }
}
